package com.ott.iot_client_demo.aliyun;

import com.ott.iot_client_demo.service.ComsumerQueueService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;


@Component
public class MNSStartup implements ApplicationRunner {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ComsumerQueueService comsumerQueueService;

    @Override
    public void run(ApplicationArguments applicationArguments) throws Exception {
        logger.info("准备连接阿里云消息队列");
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                comsumerQueueService.initServer();
            }
        });
        thread.start();
    }
}

